package com.example.mapp;

import com.example.entity.EleSafeManagement;
import org.apache.ibatis.annotations.*;

/**
 * Created by wang on 2018/4/30.
 */
@Mapper
public interface EleSafeManagementMapp {

    @Select(" select * from evelator_safe_management  where org_id=#{orgId} ")
    EleSafeManagement queryByOrgId (String orgId) throws Exception;

    @Insert("insert into evelator_safe_management " +
            "(org_id,esms,dhes,lcso,lase,laes,desm,edjr,jrea,emr,"+
            "rses,ess,edis,ms,erir,lsht,tes,esfs,mdla,eits,kmr,rmmr,"+
            "smtr,ecct,srec,sfaf,tsec,cdue,mrte,sore,eerp,pter,rere,totalohe)"+

            "values(#{orgId},#{esms},#{dhes},#{lcso},#{lase},#{laes},#{desm},#{edjr},#{jrea},#{emr},"+
            "#{rses},#{ess},#{edis},#{ms},#{erir},#{lsht},#{tes},#{esfs},#{mdla},#{eits},#{kmr},#{rmmr},"+
            "#{smtr},#{ecct},#{srec},#{sfaf},#{tsec},#{cdue},#{mrte},#{sore},#{eerp},#{pter},#{rere},#{totalohe})")
    @SelectKey(statement = "select last_insert_id()", keyProperty = "id", keyColumn = "id", before = false, resultType = Long.class)
    public Long addEleSafeManagement(EleSafeManagement EleSafeManagement) throws Exception;

    @Update("update evelator_safe_management set esms=#{esms},dhes=#{dhes},lcso=#{lcso}," +
            "lase=#{lase},laes=#{laes},desm=#{desm},edjr=#{edjr},jrea=#{jrea},emr=#{emr},rses=#{rses},ess=#{ess}," +
            "edis=#{edis},ms=#{ms},erir=#{erir},lsht=#{lsht},tes=#{tes},esfs=#{esfs},mdla=#{mdla},eits=#{eits},kmr=#{kmr}," +
            "rmmr=#{rmmr},smtr=#{smtr},ecct=#{ecct},srec=#{srec},sfaf=#{sfaf},tsec=#{tsec},cdue=#{cdue},mrte=#{mrte}," +
            "sore=#{sore},eerp=#{eerp},pter=#{pter},rere=#{rere},totalohe=#{totalohe}" +
            " where org_id=#{orgId}")
    int update(EleSafeManagement EleSafeManagement) throws Exception;


}
